import Vue from 'vue'
import App from './App.vue'
import router from './router'
import axios from "axios";
import './plugins/element'
import './assets/css/global.css'
import './assets/fonts/iconfont.css'
import TreeTable from 'vue-table-with-tree-grid'
/*  1.全局导入挂载  */
import VueQuillEditor from 'vue-quill-editor'
import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
import 'quill/dist/quill.bubble.css'


axios.defaults.baseURL = 'http://timemeetyou.com:8889/api/private/v1/'
/*  axios请求拦截 */
axios.interceptors.request.use((config) => {
  /*  为请求头对象添加token验证的Authorization字段 */
  config.headers.Authorization = window.sessionStorage.getItem('token')
  return config;
})
Vue.prototype.$http = axios
Vue.config.productionTip = false
Vue.component('tree-table',TreeTable)
Vue.use(VueQuillEditor)

//  时间过滤器
Vue.filter('timeFilter',function (originVal) {
  const time = new Date(originVal);
  const y = time.getFullYear();
  const m = (time.getMonth() + 1 +'').padStart(2,'0');
  const d = (time.getDate() + '').padStart(2,'0');
  const h = (time.getHours() + '').padStart(2,'0');
  const mi = (time.getMinutes() + '').padStart(2,'0');
  const s = (time.getSeconds() + '').padStart(2,'0');
  return `${y}-${m}-${d} ${h}:${mi}:${s}`;
})

new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
